package com.atwisdom.star.core.dao.service.impl;

import com.atwisdom.star.core.dao.pojo.ProcessRelationInstance;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atwisdom.star.core.dao.pojo.ProcessRelationInstanceHistory;
import com.atwisdom.star.core.dao.service.ProcessRelationInstanceHistoryService;
import com.atwisdom.star.core.dao.mapper.ProcessRelationInstanceHistoryMapper;
import org.springframework.stereotype.Service;

/**
* @author fushb
* @description 针对表【process_relation_instance_history】的数据库操作Service实现
* @createDate 2023-03-30 14:27:39
*/
@Service
public class ProcessRelationInstanceHistoryServiceImpl extends ServiceImpl<ProcessRelationInstanceHistoryMapper, ProcessRelationInstanceHistory>
    implements ProcessRelationInstanceHistoryService{
    @Override
    public int realDelete(QueryWrapper<ProcessRelationInstanceHistory> wrapper){
        return this.baseMapper.realDelete(wrapper);
    }

    /**
     * 同步更新实例类名称
     * @param sourceClassName 原类名
     * @param newClassName 新类名
     * @return 返回结果
     */
    @Override
    public int updateClassName(String sourceClassName, String newClassName) {
        QueryWrapper<ProcessRelationInstanceHistory> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("className", sourceClassName);
        ProcessRelationInstanceHistory processRelationInstanceHistory = new ProcessRelationInstanceHistory();
        processRelationInstanceHistory.setClassName(newClassName);
        return this.baseMapper.update(processRelationInstanceHistory, queryWrapper);
    }
}




